cap log close

global path = "****"

local name= "treatment_arms"
local date = "060820"
global logname = "$path/`name'_`date'.log"

clear
set more off
set matsize 11000
cd "$path"
log using "$logname", replace

use "$path/Data/penalty_sample.dta", clear

replace age_2017=0 if age_2017<0

gen age_45_64 = age_2017 < 65 & age_2017 >= 45



*Table: Treatment Arms

*Column 1: All Ages (intensive margin) 
reg covered1718 treatment early nonpersonalize exemption_info spanish if notall16 == 1, cl(tin)
eststo
estadd scalar nobs e(N)
summ `e(depvar)' if e(sample)& treatment==0
estadd scalar ymean=r(mean)
estimates save "$path/treatment_arms_`date'.ster", replace			

*Column 2: All Ages (Extensive margin) 
reg any_covered1718 treatment early nonpersonalize exemption_info spanish if notall16 == 1, cl(tin)
eststo
estadd scalar nobs e(N)
summ `e(depvar)' if e(sample)& treatment==0
estadd scalar ymean=r(mean)*100
estimates save "$path/treatment_arms_`date'.ster", append			

*Column 3: Ages 45-64 (Intensive margin) 
reg covered1718 treatment early nonpersonalize exemption_info spanish if notall16 == 1 & age_45_64 == 1, cl(tin)
eststo
estadd scalar nobs e(N)
summ `e(depvar)' if e(sample)& treatment==0
estadd scalar ymean=r(mean)
estimates save "$path/treatment_arms_`date'.ster", append			

*Column 4: Ages 45-64 (Extensive margin) 
reg any_covered1718 treatment early nonpersonalize exemption_info spanish if notall16 == 1 & age_45_64 == 1, cl(tin)
eststo
estadd scalar nobs e(N)
summ `e(depvar)' if e(sample)& treatment==0
estadd scalar ymean=r(mean)*100
estimates save "$path/treatment_arms_`date'.ster", append	

*Table: Mortality Effect by Treatment Arms

reg dead1718 treatment early nonpersonalize exemption_info spanish if notall16 == 1 & age_45_64 == 1, cl(tin)
eststo
estadd scalar nobs e(N)
summ `e(depvar)' if e(sample)& treatment==0
estadd scalar ymean=r(mean)*100
estimates save "$path/treatment_arms_`date'.ster", append	
			
log close

